package com.beatles.java_nio;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

/**
 * 基本缓冲区示例
 * @author loong
 * @CreateTime 2018年5月3日 下午8:41:02
 */
public class BufferedReaderDemo {
	public static void main(String[] args) throws IOException {

		Path file=null;
		BufferedReader br=null;
		String realPath=System.getProperty("user.dir");
		file=Paths.get(realPath+"/testout.txt");
		InputStream inputStream=Files.newInputStream(file);
		
		br=new BufferedReader(new InputStreamReader(inputStream));
		System.out.println("Reading the line of testout.txt file:\n"+br.readLine());
		
		br.close();
	}
}
